package lab02.test30;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test30 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        List<Float> listGrade = new ArrayList<Float>();

        System.out.println("请输入考试分数：");
        float grade = in.nextFloat();

        while (grade != 0) {
            listGrade.add(grade);
            System.out.println("请输入考试分数(或按0结束)");
            grade = in.nextFloat();
        }

        float average = 0;
        for(int i = 0; i < listGrade.size(); i++) {
            average = average + listGrade.get(i);
        }

        System.out.println("平均分:" + average / listGrade.size() );
    }
}
